package com.simon.nvwo.modules.mq;

import org.apache.commons.lang3.SerializationUtils;

import java.io.IOException;
import java.io.Serializable;

/**
 * 生产者
 *
 * @author zhaoyiwu
 * @create 2017-10-09 16:37
 **/
public class Producer extends EndPoint implements Serializable{

    public Producer(String endpointName) throws IOException {
        super(endpointName);
    }

    /**
     * 发送消息
     * @param object
     * @throws IOException
     */
    public void sendMessage(Serializable object) throws IOException {
        channel.basicPublish("",endPointName, null, SerializationUtils.serialize(object));
    }

    @Override
    public void close() throws IOException {
        super.close();
    }
}
